package com.audaque.springboot.foshanupload.web.esdatademo.model.pojo;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "user", shards = 1, replicas = 1)
public class User implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    private String id;



    @Field(type = FieldType.Keyword)
    private String first;


    @Field(type = FieldType.Keyword)
    private String parentId;



    @Field(type = FieldType.Keyword)
    private String second;

    @Field(type = FieldType.Keyword)
    private Integer age;

    // Nested 支持嵌套查询
    @Field(type = FieldType.Nested)
    private  List<User> children = new ArrayList<>();

}
